USE [MobileAppDB]
GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMAUsers]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_SelectMAUsers]  
(  
@UserId bigint
--@FirstName nvarchar(100),
--@LastName nvarchar(100),
--@Age int,
--@EmailId varchar(200),
--@Password nvarchar(50),
--@Mobile varchar(50),
--@DOB datetime,
--@CreateDateTime datetime
)  
As  
Begin

SELECT [UserId]
      ,[FirstName]
      ,[LastName]
      ,[Age]
      ,[EmailId]
      ,[Password]
      ,[Mobile]
      ,[DOB]
      ,[CreateDateTime]
  FROM MAUsers
  where UserId = @UserId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMAUserMessageAudit]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMAUserMessageAudit]  
(  
@UserMessageId bigint,  
@UserId bigint,  
@MessageId bigint,  
@DateTime DateTime
)  
As  
Begin
INSERT INTO MAUserMessageAudit
           ([UserMessageId]
           ,[UserId]
           ,[MessageId]
           ,[DateTime])
     VALUES
           (@UserMessageId
           ,@UserId
           ,@MessageId
           ,@DateTime)
End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMALanguages]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create procedure [dbo].[MASproc_SelectMALanguages]  
As  
Begin

SELECT [LanguageId]
      ,[Language]
      ,[Locale]
      ,[TimeZone]
  FROM MALanguages

End 

GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMAUserCategoryMapping]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_SelectMAUserCategoryMapping]  
(  
--@UserCategoryId bigint,  
@UserId bigint
--@CategoryId int,  
--@CreateDate datetime
)  
As  
Begin

SELECT [UserCategoryId]
      ,[UserId]
      ,[CategoryId]
      ,[CreateDate]
  FROM MAUserCategoryMapping
     WHERE UserId =@UserId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMAUserCategoryMapping]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMAUserCategoryMapping]  
(  
@UserCategoryId bigint,  
@UserId bigint,  
@CategoryId int,  
@CreateDate datetime
)  
As  
Begin

INSERT INTO MAUserCategoryMapping
           ([UserCategoryId]
           ,[UserId]
           ,[CategoryId]
           ,[CreateDate])
     VALUES
           (@UserCategoryId
           ,@UserId
           ,@CategoryId
           ,@CreateDate)

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMAMessages]    Script Date: 02/13/2013 10:20:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE procedure [dbo].[MASproc_SelectMAMessages]  

As  
Begin

SELECT [MessageId]
      ,[CategoryId]
      ,[Message]
      ,[LanguageId]
  FROM MAMessages

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMALanguages]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMALanguages]  
(  
@LanguageId int,  
@Language varchar(50),  
@Locale nchar(10),  
@TimeZone varchar(50)
)  
As  
Begin
UPDATE MALanguages
   SET [LanguageId] = @LanguageId
      ,[Language] = @Language
      ,[Locale] = @Locale
      ,[TimeZone] = @TimeZone
 WHERE LanguageId = @LanguageId
End 

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMAUsers]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMAUsers]  
(  
@UserId bigint,  
@FirstName nvarchar(100),
@LastName nvarchar(100),
@Age int,
@EmailId varchar(200),
@Password nvarchar(50),
@Mobile varchar(50),
@DOB datetime,
@CreateDateTime datetime
)  
As  
Begin

INSERT INTO [sridhar_das].[dbo].[MAUsers]
           ([UserId]
           ,[FirstName]
           ,[LastName]
           ,[Age]
           ,[EmailId]
           ,[Password]
           ,[Mobile]
           ,[DOB]
           ,[CreateDateTime])
     VALUES
           (@UserId
           ,@FirstName
           ,@LastName
           ,@Age
           ,@EmailId
           ,@Password
           ,@Mobile
           ,@DOB
           ,@CreateDateTime)

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMAUsers]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMAUsers]  
(  
@UserId bigint,  
@FirstName nvarchar(100),
@LastName nvarchar(100),
@Age int,
@EmailId varchar(200),
@Password nvarchar(50),
@Mobile varchar(50),
@DOB datetime,
@CreateDateTime datetime
)  
As  
Begin

UPDATE [sridhar_das].[dbo].[MAUsers]
   SET [UserId] = @UserId
      ,[FirstName] = @FirstName
      ,[LastName] = @LastName
      ,[Age] = @Age
      ,[EmailId] = @EmailId
      ,[Password] = @Password
      ,[Mobile] = @Mobile
      ,[DOB] = @DOB
      ,[CreateDateTime] = @CreateDateTime
 WHERE UserId = @UserId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMAUserMessageAudit]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_SelectMAUserMessageAudit]  
(  
@UserMessageId bigint,  
@UserId bigint,  
@MessageId bigint,  
@DateTime DateTime
)  
As  
Begin
SELECT [UserMessageId]
      ,[UserId]
      ,[MessageId]
      ,[DateTime]
  FROM [sridhar_das].[dbo].[MAUserMessageAudit]
  WHERE UserId = @UserId
End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMAUserMessageAudit]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMAUserMessageAudit]  
(  
@UserMessageId bigint,  
@UserId bigint,  
@MessageId bigint,  
@DateTime DateTime
)  
As  
Begin

UPDATE [sridhar_das].[dbo].[MAUserMessageAudit]
   SET [UserMessageId] = @UserMessageId
      ,[UserId] = @UserId
      ,[MessageId] = @MessageId
      ,[DateTime] = @DateTime
 WHERE UserId = @UserId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMAUserCategoryMapping]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMAUserCategoryMapping]  
(  
@UserCategoryId bigint,  
@UserId bigint,  
@CategoryId int,  
@CreateDate datetime
)  
As  
Begin

UPDATE [sridhar_das].[dbo].[MAUserCategoryMapping]
   SET [UserCategoryId] = @UserCategoryId
      ,[UserId] = @UserId
      ,[CategoryId] = @CategoryId
      ,[CreateDate] = @CreateDate
 WHERE UserId =@UserId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMAMessages]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMAMessages]  
(  
@MessageId bigint,  
@CategoryId int,  
@Message nvarchar(1000),  
@LanguageId int
)  
As  
Begin

INSERT INTO [sridhar_das].[dbo].[MAMessages]
           ([MessageId]
           ,[CategoryId]
           ,[Message]
           ,[LanguageId])
     VALUES
           (@MessageId  
			,@CategoryId  
			,@Message  
			,@LanguageId)

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMAMessages]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMAMessages]  
(  
@MessageId bigint,  
@CategoryId int,  
@Message nvarchar(1000),  
@LanguageId int
)  
As  
Begin

UPDATE [sridhar_das].[dbo].[MAMessages]
   SET [MessageId] = @MessageId
      ,[CategoryId] = @CategoryId
      ,[Message] = @Message
      ,[LanguageId] = @LanguageId
 WHERE MessageId = @MessageId

End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMALanguages]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMALanguages]  
(  
@LanguageId int,  
@Language varchar(50),  
@Locale nchar(10),  
@TimeZone varchar(50)
)  
As  
Begin

INSERT INTO [sridhar_das].[dbo].[MALanguages]
           ([LanguageId]
           ,[Language]
           ,[Locale]
           ,[TimeZone])
     VALUES
           (@LanguageId
           ,@Language
           ,@Locale
           ,@TimeZone)

End 

GO

/****** Object:  StoredProcedure [dbo].[MASproc_SelectMACategories]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_SelectMACategories]  
(  
@CategoryId int,  
@CategoryName nvarchar(50),  
@Description varchar(500),  
@Status bit,  
@CreateDateTime datetime
)  
As  
Begin
SELECT [CategoryId]
      ,[CategoryName]
      ,[Description]
      ,[Status]
      ,[CreateDateTime]
  FROM [sridhar_das].[dbo].[MACategories]
End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_InsertMACategories]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_InsertMACategories]  
(  
@CategoryId int,  
@CategoryName nvarchar(50),  
@Description varchar(500),  
@Status bit,  
@CreateDateTime datetime
)  
As  
Begin
INSERT INTO [sridhar_das].[dbo].[MACategories]
           ([CategoryId]
           ,[CategoryName]
           ,[Description]
           ,[Status]
           ,[CreateDateTime])
     VALUES
           (@CategoryId
           ,@CategoryName
           ,@Description
           ,@Status
           ,@CreateDateTime)
End

GO

/****** Object:  StoredProcedure [dbo].[MASproc_UpdateMACategories]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create procedure [dbo].[MASproc_UpdateMACategories]  
(  
@CategoryId int,  
@CategoryName nvarchar(50),  
@Description varchar(500),  
@Status bit,  
@CreateDateTime datetime
)  
As  
Begin
UPDATE [sridhar_das].[dbo].[MACategories]
   SET [CategoryId] = @CategoryId
      ,[CategoryName] = @CategoryName
      ,[Description] = @Description
      ,[Status] = @Status
      ,[CreateDateTime] = @CreateDateTime
 WHERE CategoryId = @CategoryId
End

GO

/****** Object:  StoredProcedure [dbo].[USP_Users_Create]    Script Date: 02/13/2013 10:20:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[USP_Users_Create] 
	@UserId bigint,
	@FirstName nvarchar(100),
	@LastName nvarchar(100),
	@Age int,
	@EmailId varchar(200),
	@Password nvarchar(50),
	@Mobile varchar(50),
	@DOB datetime
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	
END

GO

